﻿/*
大数的乘法 
Time Limit:1000MS  Memory Limit:32768K


Description:
给出一些整数对，一个为可能接近100位的大数，另一个为1位数，求这些数对的乘积。

Sample Input:
1 1
123 0
12345678910 8
123456789101234567891012345678910 7
Sample Output:
1
0
98765431280
864197523708641975237086419752370
*/
#include <iostream>
#include <cstdlib>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
	string bignum;
	int num;
	while (cin>>bignum>>num)
	{
		if(0==num)
			cout<<0<<endl;
		else if(1==num)
			cout<<bignum<<endl;
		else
		{
			string result;
			int carry=0;
			
			for (string::reverse_iterator it=bignum.rbegin(); it!=bignum.rend(); ++it)
			{
				int product=(*it-'0')*num+carry;
				result+= (product%10+'0');
				carry=product/10;
			}
			while (carry)
			{
				result+=(carry%10+'0');
				carry/=10;
			}
			reverse(result.begin(), result.end());
			cout<<result<<endl;			
		}
	}
	return EXIT_SUCCESS;
}